package com.wc.AlgoOJ_train.train1.c1.A105;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/12/26 4:14
 * 杨辉三角
 * http://43.138.190.70:8888/p/A105
 * @description
 */
public class Main {
    public static void main(String[] args) {
        int[][] rows = new int[31][16];
        StringBuffer[] answers = new StringBuffer[31];
        StringBuffer row = new StringBuffer();
        row.append(1);
        row.append('\n');
        answers[1] = new StringBuffer(row);
        rows[1][1] = 1;

        for (int i = 2; i <= 30; i++) {
            rows[i][1] = 1;
            int bound = (i + 1) / 2;
            for (int j = 2; j <= bound; j++) {
                rows[i][j] = rows[i - 1][j] + rows[i - 1][j - 1];
            }
            boolean isOdd = (i & 1) == 1;
            if (isOdd) {
                rows[i][bound] = rows[i - 1][bound - 1] * 2;
            }
            row.append(rows[i][1]);
            for (int j = 2; j <= bound; j++) {
                row.append(' ');
                row.append(rows[i][j]);
            }
            if (isOdd) {
                bound--;
            }
            for (int j = bound; j >= 1; j--) {
                row.append(' ');
                row.append(rows[i][j]);
            }
            row.append('\n');
            answers[i] = answers[i] = new StringBuffer(row);
        }

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()){
            int idx = sc.nextInt();
            System.out.println(answers[idx]);
        }
    }
}
